import { defineStore } from 'pinia';
export const useUserStore = defineStore('user', {
    state() {
        return {
            userid: localStorage.getItem('userid')||'',
            tel: localStorage.getItem('tel')||''
        }
    },
    actions: {
        setUserId(payload: string) {
            this.userid = payload
            localStorage.setItem('userid', payload)
        },
        setTel(payload: string) {
            this.tel = payload
            localStorage.setItem('tel', payload)
        },
        logout() {
            this.userid = ''
            this.tel = ''
            localStorage.removeItem('userid')
            localStorage.removeItem('tel')
            localStorage.removeItem('token')
        }
    }
})